package com.example.friend;

import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import androidx.constraintlayout.widget.ConstraintLayout;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.example.friend.mvp.ui.activity.CircleActivity;
import com.example.okhttputils.mvp.base.App;
import com.example.okhttputils.mvp.base.BaseFragment;
import com.example.okhttputils.mvp.base.BaseModel;
import com.example.okhttputils.mvp.presenter.ArtListPresenter;
import com.example.okhttputils.mvp.ui.view.ArtListView;

import java.util.HashMap;


@Route(path = "/friend/fragment")
public class FriendFragment extends BaseFragment<ArtListPresenter> implements ArtListView{
    TextView tvTitle;
    ConstraintLayout clUser;
    public String title;

    @Override
    protected void loadData() {
    }

    @Override
    public void onResume() {
        super.onResume();
        getProfit();
    }

    private void getProfit() {
        HashMap<String, String> map = new HashMap<>();
        map.put("pagesize", "0");
        presenter.getArtList(map);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fm_friend;
    }

    @Override
    protected void initView() {
        tvTitle = rootView.findViewById(R.id.tv_title);
        clUser = rootView.findViewById(R.id.cl_user);
        tvTitle.setText("好友");
    }

    @Override
    protected void addListener() {
        clUser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(context, CircleActivity.class));
            }
        });
    }

    @Override
    protected ArtListPresenter createPresenter() {
        return new ArtListPresenter(this);
    }

    public void setTitle(String title2) {
        this.title = title2;
    }

    @Override
    public void onArtList(BaseModel o) {
        Log.e("data + -------------", o.getData().toString());
    }

}
